import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { BaseService } from 'src/modules/base.service';
import { Repository } from 'typeorm';
import { User } from '../user/user.entity';
import { CreateDepartmentDto, UpdateDepartmentDto } from './department.dto';
import { Department } from './department.entity';
@Injectable()
export class DepartmentService extends BaseService {
  module: Repository<Department>;
  constructor(
    @InjectRepository(Department)
    private rolesRepository: Repository<Department>,
    @InjectRepository(User)
    private usersRepository: Repository<User>,
  ) {
    super();
    this.module = this.rolesRepository;
  }

  async create(data: CreateDepartmentDto): Promise<any> {
    console.log(this.usersRepository);
    return await this.rolesRepository.save(data);
  }

  async update(data: UpdateDepartmentDto): Promise<any> {
    return this.rolesRepository.save(data);
  }
}
